interfaces/cantact: Handle None timeout by setting to 0xFFF...#2026
interfaces/cantact: Handle None timeout by setting to 0xFFF...#2026BenGardiner wants to merge 1 commit intohardbyte:mainfrom
Conversation
|
But The cantact lib calls |
|
Hi @zariiii9003 ; yes i think you're 100% right. I wonder: should these other cases of drivers treating None as 0 be fixed also?
|
|
The usb2can implementation seems correct to me. If our The gs_usb implementation seems wrong indeed. The candle_bus implementation also seems incorrect, but that's not part of this repo. |
|
thank you @zariiii9003 . I fixed this change to cantact with a force-push. I made this BIRLab/python-can-candle#5 for python-can-cantact I am not sure how to fix gs-usb and also these days I find it hard to test it since it requires libusbK. I don't use it almost ever since the cantact (and now python-can-candle) drivers work with the exact same devices... |
|
Thank you! Please add a short news fragment and i'll merge. Regarding gs-usb: it seems to be similar to usb2can, to block forever the read function needs to be called with 0: |
timeout=None means block forever
pass '0' when timeout=None (as proposed by @zariiii9003 in hardbyte#2026 (comment))
pass '0' when timeout=None (as proposed by @zariiii9003 in hardbyte#2026 (comment))
pass '0' when timeout=None (as proposed by @zariiii9003 in hardbyte#2026 (comment))
Summary of Changes
There are definitely cases of client code that end up passing timeout=None to _recv_internal(). Several other interfaces/*.py are prepared for this e.g. canalystii usb2can canlib_vcinpl2 gs_usb.py
For cantact I think the right thing to do is set default timeout to 0 if None is provided.
There are definitely cases of client code that end up passing timeout=None to _recv_internal(). Several other interfaces/*.py are prepared for this e.g. canalystii usb2can canlib_vcinpl2 gs_usb.py
For cantact I think the right thing to do is set default timeout to 0 if None is provided.
Type of Change
Checklist
tox).